<!DOCTYPE html>
<html>
<head>
	<title>对象</title>
</head>
<body>
<script type="text/javascript">
	
	// 使用对象字面量创建对象
	var people = {
		name: 'cuihao',
		age: 18,
		say: function() {
			alert('name:' + this.name + " age:"+ this.age);
		}
	}
	people.say()


	// 使用构造函数
	var People = new Object();
	People.name = "cuihao";
	People.say = function() {
		alert(this.name);
	}
	People.say()


	// 使用函数创建对象
	function Man(name) {
		let Man = {
			name: name,
			say: function() {
				alert(this.name);
			}
		}
		return Man;
	}
	let man = Man('cuihao');
	man.say()

</script>
</body>
</html>